/*
 * @Author: JohnYang
 * @Date: 2020-09-22 20:57:03
 * @LastEditors: JohnYang
 * @LastEditTime: 2020-09-28 21:37:09
 */
import request from "@/utils/request";

const client_id = "web";
const client_secret = "123456";
const scope = "server";

// 登录方法
export function login(username, password) {
  return request({
    url: "/index/login/login",
    method: "post",
    data: {
      account: username,
      password
    }
  });
  // return new Promise((resolve, reject) => {
  //   resolve({
  //     access_token: "6be76c3b-4701-4e2f-8864-3a004596b18a",
  //     token_type: "bearer",
  //     refresh_token: "a5a44dd8-789d-4b6d-839e-17f020a474e0",
  //     expires_in: 3599,
  //     scope: "server",
  //     user_id: 27,
  //     username: "ad,=min"
  //   });
  // });
}

// 刷新方法
export function refreshToken({ username, password }) {
  return request({
    url: "/index/login/login",
    method: "post",
    data: {
      account: username,
      password
    }
  });
}

// 退出方法
export function logout() {
  return Promise.resolve({
    data: null,
    code: 0,
    msg: "退出成功!"
  });
}
